package controllers;
import business.ApiService;
import models.cms_channel;
import models.cms_news;
import play.mvc.Controller;
import utils.PageBean;
import java.util.List;

/**
 * 后台登录, 增删改 统一用 ajax, 查用 回发
 */
public class FrontCenter extends Controller {
    public static void index(){

        render("FrontCenter/index.html");
    }
    public static void product(){
        long channel_id = 1;
        PageBean<cms_news> pageBean = ApiService.getNewsList("",channel_id);
        render(pageBean);
    }
    public static void news(){
        long channel_id = 2;
        PageBean<cms_news> pageBean = ApiService.getNewsList("",channel_id);
        render(pageBean);
    }
    public static void news_detail(long id){
        cms_news obj = cms_news.findById(id);
        render(obj);
    }
    public static void case1(){
        render();
    }
    public static void about(){
        render();
    }
    public static void sitemap(){
        List<cms_news> newsList = cms_channel.find("from cms_news order by id desc ").fetch();
        List<cms_channel> channelList = cms_channel.find("from cms_channel where pid=0 order by id desc ").fetch();
        render(newsList,channelList);
    }
}
